home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / TTABLE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  10KB  |  326 lines

  1. /* $Id: ttable.h,v 1.10 1998/09/25 01:09:45 davem Exp $ */
  2. #ifndef _SPARC64_TTABLE_H
  3. #define _SPARC64_TTABLE_H
  4.  
  5. #include <linux/config.h>
  6. #include <asm/asm_offsets.h>
  7. #include <asm/utrap.h>
  8.  
  9. #define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
  10.  
  11. /* We need a "cleaned" instruction... */
  12. #define CLEAN_WINDOW                            \
  13.     rdpr    %cleanwin, %l0;        add    %l0, 1, %l0;        \
  14.     wrpr    %l0, 0x0, %cleanwin;                    \
  15.     clr    %o0;    clr    %o1;    clr    %o2;    clr    %o3;    \
  16.     clr    %o4;    clr    %o5;    clr    %o6;    clr    %o7;    \
  17.     clr    %l0;    clr    %l1;    clr    %l2;    clr    %l3;    \
  18.     clr    %l4;    clr    %l5;    clr    %l6;    clr    %l7;    \
  19.     retry;                                \
  20.     nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
  21.  
  22. #define TRAP(routine)                    \
  23.     sethi    %hi(109f), %g7;                \
  24.     ba,pt    %xcc, etrap;                \
  25. 109:     or    %g7, %lo(109b), %g7;            \
  26.     call    routine;                \
  27.      add    %sp, STACK_BIAS + REGWIN_SZ, %o0;    \
  28.     ba,pt    %xcc, rtrap;                \
  29.      clr    %l6;                    \
  30.     nop;
  31.  
  32. #define TRAP_NOSAVE(routine)                \
  33.     ba,pt    %xcc, routine;                \
  34.      nop;                        \
  35.     nop; nop; nop; nop; nop; nop;
  36.  
  37. #define TRAPTL1(routine)                \
  38.     sethi    %hi(109f), %g7;                \
  39.     ba,pt    %xcc, etraptl1;                \
  40. 109:     or    %g7, %lo(109b), %g7;            \
  41.     call    routine;                \
  42.      add    %sp, STACK_BIAS + REGWIN_SZ, %o0;    \
  43.     ba,pt    %xcc, rtrap;                \
  44.      clr    %l6;                    \
  45.     nop;
  46.     
  47. #define TRAP_ARG(routine, arg)                \
  48.     sethi    %hi(109f), %g7;                \
  49.     ba,pt    %xcc, etrap;                \
  50. 109:     or    %g7, %lo(109b), %g7;            \
  51.     add    %sp, STACK_BIAS + REGWIN_SZ, %o0;    \
  52.     call    routine;                \
  53.      mov    arg, %o1;                \
  54.     ba,pt    %xcc, rtrap;                \
  55.      clr    %l6;
  56.     
  57. #define TRAPTL1_ARG(routine, arg)            \
  58.     sethi    %hi(109f), %g7;                \
  59.     ba,pt    %xcc, etraptl1;                \
  60. 109:     or    %g7, %lo(109b), %g7;            \
  61.     add    %sp, STACK_BIAS + REGWIN_SZ, %o0;    \
  62.     call    routine;                \
  63.      mov    arg, %o1;                \
  64.     ba,pt    %xcc, rtrap;                \
  65.      clr    %l6;
  66.     
  67. #define SYSCALL_TRAP(routine, systbl)            \
  68.     sethi    %hi(109f), %g7;                \
  69.     ba,pt    %xcc, scetrap;                \
  70. 109:     or    %g7, %lo(109b), %g7;            \
  71.     call    routine;                \
  72.      sethi    %hi(systbl), %l7;            \
  73.     nop; nop; nop;
  74.     
  75. #define INDIRECT_SOLARIS_SYSCALL(num)            \
  76.     sethi    %hi(109f), %g7;                \
  77.     ba,pt    %xcc, etrap;                \
  78. 109:     or    %g7, %lo(109b), %g7;            \
  79.     ba,pt    %xcc, tl0_solaris + 0xc;        \
  80.      mov    num, %g1;                \
  81.     nop;nop;nop;
  82.     
  83. #define TRAP_UTRAP(handler,lvl)                        \
  84.     ldx    [%g6 + AOFF_task_tss + AOFF_thread_utraps], %g1;    \
  85.     sethi    %hi(109f), %g7;                        \
  86.     brz,pn    %g1, utrap;                        \
  87.      or    %g7, %lo(109f), %g7;                    \
  88.     ba,pt    %xcc, utrap;                        \
  89. 109:     ldx    [%g1 + handler*8], %g1;                    \
  90.     ba,pt    %xcc, utrap_ill;                    \
  91.      mov    lvl, %o1;
  92.  
  93. #define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table)
  94. #define    LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
  95. #define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
  96. #define GETCC_TRAP TRAP(getcc)
  97. #define SETCC_TRAP TRAP(setcc)
  98. #ifdef CONFIG_SOLARIS_EMUL
  99. #define SOLARIS_SYSCALL_TRAP TRAP(solaris_sparc_syscall)
  100. #else
  101. #define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall)
  102. #endif
  103. /* FIXME: Write these actually */    
  104. #define NETBSD_SYSCALL_TRAP TRAP(netbsd_syscall)
  105. #define BREAKPOINT_TRAP TRAP(breakpoint_trap)
  106.  
  107. #define TRAP_IRQ(routine, level)            \
  108.     rdpr    %pil, %g2;                \
  109.     wrpr    %g0, 15, %pil;                \
  110.     b,pt    %xcc, etrap_irq;            \
  111.      rd    %pc, %g7;                \
  112.     mov    level, %o0;                \
  113.     call    routine;                \
  114.      add    %sp, STACK_BIAS + REGWIN_SZ, %o1;    \
  115.     ba,a,pt    %xcc, rtrap_clr_l6;
  116.     
  117. #define TICK_SMP_IRQ                    \
  118.     rdpr    %pil, %g2;                \
  119.     wrpr    %g0, 15, %pil;                \
  120.     sethi    %hi(109f), %g7;                \
  121.     b,pt    %xcc, etrap_irq;            \
  122. 109:     or    %g7, %lo(109b), %g7;            \
  123.     call    smp_percpu_timer_interrupt;        \
  124.      add    %sp, STACK_BIAS + REGWIN_SZ, %o0;    \
  125.     ba,a,pt    %xcc, rtrap_clr_l6;
  126.  
  127. #define TRAP_IVEC TRAP_NOSAVE(do_ivec)
  128.  
  129. #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
  130.  
  131. #define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
  132.  
  133. #define FLUSH_WINDOW_TRAP                        \
  134.     ba,pt    %xcc, etrap;                        \
  135.      rd    %pc, %g7;                        \
  136.     flushw;                                \
  137.     ldx    [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC], %l1;    \
  138.     add    %l1, 4, %l2;                        \
  139.     stx    %l1, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TPC];    \
  140.     ba,pt    %xcc, rtrap_clr_l6;                    \
  141.      stx    %l2, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC];
  142.             
  143. /* Before touching these macros, you owe it to yourself to go and
  144.  * see how arch/sparc64/kernel/winfixup.S works... -DaveM
  145.  */
  146.  
  147. /* Normal kernel spill */
  148. #define SPILL_0_NORMAL                    \
  149.     stx    %l0, [%sp + STACK_BIAS + 0x00];        \
  150.     stx    %l1, [%sp + STACK_BIAS + 0x08];        \
  151.     stx    %l2, [%sp + STACK_BIAS + 0x10];        \
  152.     stx    %l3, [%sp + STACK_BIAS + 0x18];        \
  153.     stx    %l4, [%sp + STACK_BIAS + 0x20];        \
  154.     stx    %l5, [%sp + STACK_BIAS + 0x28];        \
  155.     stx    %l6, [%sp + STACK_BIAS + 0x30];        \
  156.     stx    %l7, [%sp + STACK_BIAS + 0x38];        \
  157.     stx    %i0, [%sp + STACK_BIAS + 0x40];        \
  158.     stx    %i1, [%sp + STACK_BIAS + 0x48];        \
  159.     stx    %i2, [%sp + STACK_BIAS + 0x50];        \
  160.     stx    %i3, [%sp + STACK_BIAS + 0x58];        \
  161.     stx    %i4, [%sp + STACK_BIAS + 0x60];        \
  162.     stx    %i5, [%sp + STACK_BIAS + 0x68];        \
  163.     stx    %i6, [%sp + STACK_BIAS + 0x70];        \
  164.     stx    %i7, [%sp + STACK_BIAS + 0x78];        \
  165.     saved; retry; nop; nop; nop; nop; nop; nop;    \
  166.     nop; nop; nop; nop; nop; nop; nop; nop;
  167.  
  168. /* Normal 64bit spill */
  169. #define SPILL_1_GENERIC(xxx)                \
  170.     wr    %g0, xxx, %asi;                \
  171.     stxa    %l0, [%sp + STACK_BIAS + 0x00] %asi;    \
  172.     stxa    %l1, [%sp + STACK_BIAS + 0x08] %asi;    \
  173.     stxa    %l2, [%sp + STACK_BIAS + 0x10] %asi;    \
  174.     stxa    %l3, [%sp + STACK_BIAS + 0x18] %asi;    \
  175.     stxa    %l4, [%sp + STACK_BIAS + 0x20] %asi;    \
  176.     stxa    %l5, [%sp + STACK_BIAS + 0x28] %asi;    \
  177.     stxa    %l6, [%sp + STACK_BIAS + 0x30] %asi;    \
  178.     stxa    %l7, [%sp + STACK_BIAS + 0x38] %asi;    \
  179.     stxa    %i0, [%sp + STACK_BIAS + 0x40] %asi;    \
  180.     stxa    %i1, [%sp + STACK_BIAS + 0x48] %asi;    \
  181.     stxa    %i2, [%sp + STACK_BIAS + 0x50] %asi;    \
  182.     stxa    %i3, [%sp + STACK_BIAS + 0x58] %asi;    \
  183.     stxa    %i4, [%sp + STACK_BIAS + 0x60] %asi;    \
  184.     stxa    %i5, [%sp + STACK_BIAS + 0x68] %asi;    \
  185.     stxa    %i6, [%sp + STACK_BIAS + 0x70] %asi;    \
  186.     stxa    %i7, [%sp + STACK_BIAS + 0x78] %asi;    \
  187.     saved; retry; nop; nop; nop; nop; nop; nop;    \
  188.     nop; nop; nop; nop;                \
  189.     b,a,pt    %xcc, spill_fixup_dax;            \
  190.     b,a,pt    %xcc, spill_fixup_mna;            \
  191.     b,a,pt    %xcc, spill_fixup;
  192.  
  193. /* Normal 32bit spill */
  194. #define SPILL_2_GENERIC(xxx)                \
  195.     wr    %g0, xxx, %asi;                \
  196.     srl    %sp, 0, %sp;                \
  197.     stwa    %l0, [%sp + 0x00] %asi;            \
  198.     stwa    %l1, [%sp + 0x04] %asi;            \
  199.     stwa    %l2, [%sp + 0x08] %asi;            \
  200.     stwa    %l3, [%sp + 0x0c] %asi;            \
  201.     stwa    %l4, [%sp + 0x10] %asi;            \
  202.     stwa    %l5, [%sp + 0x14] %asi;            \
  203.     stwa    %l6, [%sp + 0x18] %asi;            \
  204.     stwa    %l7, [%sp + 0x1c] %asi;            \
  205.     stwa    %i0, [%sp + 0x20] %asi;            \
  206.     stwa    %i1, [%sp + 0x24] %asi;            \
  207.     stwa    %i2, [%sp + 0x28] %asi;            \
  208.     stwa    %i3, [%sp + 0x2c] %asi;            \
  209.     stwa    %i4, [%sp + 0x30] %asi;            \
  210.     stwa    %i5, [%sp + 0x34] %asi;            \
  211.     stwa    %i6, [%sp + 0x38] %asi;            \
  212.     stwa    %i7, [%sp + 0x3c] %asi;            \
  213.     saved; retry; nop; nop; nop; nop;        \
  214.     nop; nop; nop; nop; nop;            \
  215.     b,a,pt    %xcc, spill_fixup_dax;            \
  216.     b,a,pt    %xcc, spill_fixup_mna;            \
  217.     b,a,pt    %xcc, spill_fixup;
  218.  
  219. #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
  220. #define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
  221. #define SPILL_3_NORMAL SPILL_0_NORMAL
  222. #define SPILL_4_NORMAL SPILL_0_NORMAL
  223. #define SPILL_5_NORMAL SPILL_0_NORMAL
  224. #define SPILL_6_NORMAL SPILL_0_NORMAL
  225. #define SPILL_7_NORMAL SPILL_0_NORMAL
  226.  
  227. #define SPILL_0_OTHER SPILL_0_NORMAL
  228. #define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
  229. #define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
  230. #define SPILL_3_OTHER SPILL_3_NORMAL
  231. #define SPILL_4_OTHER SPILL_4_NORMAL
  232. #define SPILL_5_OTHER SPILL_5_NORMAL
  233. #define SPILL_6_OTHER SPILL_6_NORMAL
  234. #define SPILL_7_OTHER SPILL_7_NORMAL
  235.  
  236. /* Normal kernel fill */
  237. #define FILL_0_NORMAL                    \
  238.     ldx    [%sp + STACK_BIAS + 0x00], %l0;        \
  239.     ldx    [%sp + STACK_BIAS + 0x08], %l1;        \
  240.     ldx    [%sp + STACK_BIAS + 0x10], %l2;        \
  241.     ldx    [%sp + STACK_BIAS + 0x18], %l3;        \
  242.     ldx    [%sp + STACK_BIAS + 0x20], %l4;        \
  243.     ldx    [%sp + STACK_BIAS + 0x28], %l5;        \
  244.     ldx    [%sp + STACK_BIAS + 0x30], %l6;        \
  245.     ldx    [%sp + STACK_BIAS + 0x38], %l7;        \
  246.     ldx    [%sp + STACK_BIAS + 0x40], %i0;        \
  247.     ldx    [%sp + STACK_BIAS + 0x48], %i1;        \
  248.     ldx    [%sp + STACK_BIAS + 0x50], %i2;        \
  249.     ldx    [%sp + STACK_BIAS + 0x58], %i3;        \
  250.     ldx    [%sp + STACK_BIAS + 0x60], %i4;        \
  251.     ldx    [%sp + STACK_BIAS + 0x68], %i5;        \
  252.     ldx    [%sp + STACK_BIAS + 0x70], %i6;        \
  253.     ldx    [%sp + STACK_BIAS + 0x78], %i7;        \
  254.     restored; retry; nop; nop; nop; nop; nop; nop;    \
  255.     nop; nop; nop; nop; nop; nop; nop; nop;
  256.  
  257. /* Normal 64bit fill */
  258. #define FILL_1_GENERIC(xxx)                \
  259.     wr    %g0, xxx, %asi;                \
  260.     ldxa    [%sp + STACK_BIAS + 0x00] %asi, %l0;    \
  261.     ldxa    [%sp + STACK_BIAS + 0x08] %asi, %l1;    \
  262.     ldxa    [%sp + STACK_BIAS + 0x10] %asi, %l2;    \
  263.     ldxa    [%sp + STACK_BIAS + 0x18] %asi, %l3;    \
  264.     ldxa    [%sp + STACK_BIAS + 0x20] %asi, %l4;    \
  265.     ldxa    [%sp + STACK_BIAS + 0x28] %asi, %l5;    \
  266.     ldxa    [%sp + STACK_BIAS + 0x30] %asi, %l6;    \
  267.     ldxa    [%sp + STACK_BIAS + 0x38] %asi, %l7;    \
  268.     ldxa    [%sp + STACK_BIAS + 0x40] %asi, %i0;    \
  269.     ldxa    [%sp + STACK_BIAS + 0x48] %asi, %i1;    \
  270.     ldxa    [%sp + STACK_BIAS + 0x50] %asi, %i2;    \
  271.     ldxa    [%sp + STACK_BIAS + 0x58] %asi, %i3;    \
  272.     ldxa    [%sp + STACK_BIAS + 0x60] %asi, %i4;    \
  273.     ldxa    [%sp + STACK_BIAS + 0x68] %asi, %i5;    \
  274.     ldxa    [%sp + STACK_BIAS + 0x70] %asi, %i6;    \
  275.     ldxa    [%sp + STACK_BIAS + 0x78] %asi, %i7;    \
  276.     restored; retry; nop; nop; nop; nop; nop; nop;    \
  277.     nop; nop; nop; nop;                \
  278.     b,a,pt    %xcc, fill_fixup_dax;            \
  279.     b,a,pt    %xcc, fill_fixup_mna;            \
  280.     b,a,pt    %xcc, fill_fixup;
  281.  
  282. /* Normal 32bit fill */
  283. #define FILL_2_GENERIC(xxx)                \
  284.     wr    %g0, xxx, %asi;                \
  285.     srl    %sp, 0, %sp;                \
  286.     lduwa    [%sp + 0x00] %asi, %l0;            \
  287.     lduwa    [%sp + 0x04] %asi, %l1;            \
  288.     lduwa    [%sp + 0x08] %asi, %l2;            \
  289.     lduwa    [%sp + 0x0c] %asi, %l3;            \
  290.     lduwa    [%sp + 0x10] %asi, %l4;            \
  291.     lduwa    [%sp + 0x14] %asi, %l5;            \
  292.     lduwa    [%sp + 0x18] %asi, %l6;            \
  293.     lduwa    [%sp + 0x1c] %asi, %l7;            \
  294.     lduwa    [%sp + 0x20] %asi, %i0;            \
  295.     lduwa    [%sp + 0x24] %asi, %i1;            \
  296.     lduwa    [%sp + 0x28] %asi, %i2;            \
  297.     lduwa    [%sp + 0x2c] %asi, %i3;            \
  298.     lduwa    [%sp + 0x30] %asi, %i4;            \
  299.     lduwa    [%sp + 0x34] %asi, %i5;            \
  300.     lduwa    [%sp + 0x38] %asi, %i6;            \
  301.     lduwa    [%sp + 0x3c] %asi, %i7;            \
  302.     restored; retry; nop; nop; nop; nop;        \
  303.     nop; nop; nop; nop; nop;            \
  304.     b,a,pt    %xcc, fill_fixup_dax;            \
  305.     b,a,pt    %xcc, fill_fixup_mna;            \
  306.     b,a,pt    %xcc, fill_fixup;
  307.  
  308. #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
  309. #define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
  310. #define FILL_3_NORMAL FILL_0_NORMAL
  311. #define FILL_4_NORMAL FILL_0_NORMAL
  312. #define FILL_5_NORMAL FILL_0_NORMAL
  313. #define FILL_6_NORMAL FILL_0_NORMAL
  314. #define FILL_7_NORMAL FILL_0_NORMAL
  315.  
  316. #define FILL_0_OTHER FILL_0_NORMAL
  317. #define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
  318. #define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
  319. #define FILL_3_OTHER FILL_3_NORMAL
  320. #define FILL_4_OTHER FILL_4_NORMAL
  321. #define FILL_5_OTHER FILL_5_NORMAL
  322. #define FILL_6_OTHER FILL_6_NORMAL
  323. #define FILL_7_OTHER FILL_7_NORMAL
  324.  
  325. #endif /* !(_SPARC64_TTABLE_H) */
  326.